package com.viking.car;


import java.net.ServerSocket;
import java.net.Socket;

/**
 * 服务端代码
 */
public class Server {
    public static void main(String[] args) throws Exception {
        if (args.length != 1){
            System.out.println("number of args is illegal.specify a port number.");
        }
        int port = Integer.parseInt(args[0]);
        ServerSocket serverSocket = new ServerSocket(port);
        while (true){
            Socket socket = serverSocket.accept();
            new SocketHandler(socket).start();
        }
    }
}
